#ifndef SAGEVIS_H
#define SAGEVIS_H

#include <QObject>
#include <QGraphicsWidget>
#include <QRectF>
#include <QPainter>
#include <QPainterPath>
#include <QString>
#include <QVector>
#include <QPointer>
#include <QDebug>
#include <QList>
#include <QTimer>
#include <QProcess>
#include <QFileDialog>
#include <QApplication>

//Forward declarations to avoid circular dependencies
class GenoSage;
class VisBaseWidget;
class MultiGeneRegionVisWidget;

//Which data type is being loaded.
//CHANGE NEEDED:  Later should be able to load data from different origins.
#define     PROPRIETARY_DATA     0
#define     PUBMED_DATA     1
const int DATA_TYPE = PUBMED_DATA;

/**SageVis class.
  * SageVis manages VisWidgets in SageNext.
  * At the moment it primarily launches and stores the VisWidgets.
  * Eventual functions in this class likely include:
  *    - control linking between vis widgets
  *    - control placement of vis widgets -- special tiling schemes
  *    - coordinates between GUI control bars and actions within the widget
*/
class SageVis : public QGraphicsWidget
{
    Q_OBJECT

public:
    /** SageVis constructor.
      * Constructor may take a QGraphicsItem as a parent, but it is not essential.
      * Presently runs parent-less in the scene.
      */
    explicit SageVis(QGraphicsItem *parent = 0);

    /** SageVis destructor.
      * Deletes VisWidgets that have been created
      * Also deletes internal timer
      */
    ~SageVis();

    //2 ways to launch a widget
    //  1:  Specify type of widget and data file/s (perhaps in SAGENext comes from drag and drop event)
    //  2:  Specify type of widget.  Widget will launch file browser to get data file(s) from user. Or no data required for widget

    /** launchVisWidget(QString type, QString pathToData) - 2 parameter launchVisWidget function.
      * This function takes as parameters both the type of VisWidget to be launched and the data file(s).
      * Right now I am not using this function, but I include it because eventually file upload to a visWidget may occur via
      * drag-and-drop events from SAGENextPointers.
      *    @param type is the type of VisWidget to be launched
      *    @param pathToData is the path to the data file (or directory, perhaps...?) where data to be visualized can be found
      *    @return void.  May change this later to show whether VisWidget launch succeeded - eventually will communicate any problems in data upload or visWidget creation
      *    @see launchWidget(QString type, QString pathToData)
      */
    void launchVisWidget(QString type, QString pathToData);

    /** launchVisWidget(QString type) - 1 parameter launchVisWidget function.
      * This is the function I use to launch the MonsantoBacterialGenomeViewer
      * It specifies just the type of VisWidget to launch
      * The VisWidget itself must ask the users for the data files, and manage data upload
      *    @param type is the type of VisWidget to be launched
      *    @return void. May change this later to show whether VisWidget launch succeeded - eventually will communicate any problems in data upload or visWidget creation
      *    @see launchWidget(QString type)
      */
    void launchVisWidget(QString type);

private:
    QList< QPointer<VisBaseWidget> > widgets;  /**< list of widgets that SageVis is managing. */
    QPointer<QTimer> timer; /**< Timer permits animations within VisWidgets.  VisWidgets must implement an 'advance' function, to catch these signals and advance the animation*/

    QPointer<GenoSage> genoSage;  /**< genoSage object is given a pointer to all genoSageWidgets and will have its own management operations that control these widgets.*/
        //NOTE:  If more managers are created, I could make a base 'manager' class, then store a list of managers.
        //       Not sure if this is needed though, so I'll leave it for later

};


#endif // SAGEVIS_H
